package com.twu.biblioteca;

import javax.swing.*;
import java.awt.*;

/**
 * Created with IntelliJ IDEA.
 * User: ruchita
 * Date: 19/9/13
 * Time: 10:52 AM
 * To change this template use File | Settings | File Templates.
 */
public class ListBooksPage {
    public ListBooksPage() {
        DefaultListModel dlm = new DefaultListModel();
        //Get list of books from sample database  and add to list model
        BooksSampleDatabase s = new BooksSampleDatabase();
        s.createDatabase();
        for (String BookName : s.getBookList())
            dlm.addElement(BookName);

        //setting the boolList to Jlist
        BookList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
        BookList.setModel(dlm);
    }

    public JPanel panel1;
    public JList BookList;

    {
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
        $$$setupUI$$$();
    }

    /**
     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     *
     * @noinspection ALL
     */
    private void $$$setupUI$$$() {
        panel1 = new JPanel();
        panel1.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
        panel1.putClientProperty("html.disable", Boolean.FALSE);
        BookList = new JList();
        BookList.setForeground(new Color(-16777012));
        BookList.setSelectionMode(1);
        panel1.add(BookList);
    }

    /**
     * @noinspection ALL
     */
    public JComponent $$$getRootComponent$$$() {
        return panel1;
    }
}
